package com.sy.service.impl;

import com.sy.exception.BusinessException;
import com.sy.mapper.GradeMapper;
import com.sy.service.GradeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @Author:ZHF
 * @Date: 2021/10/13 16:37
 */
@Service
public class GradeServiceImpl implements GradeService {
    @Autowired
    private GradeMapper gradeMapper;

    @Override
    public List<String> getAllGrade() {
        List<String> allGrade = gradeMapper.getAllGrade();
        if (allGrade.isEmpty()){
            throw new BusinessException(HttpStatus.NOT_FOUND, "年级信息不存在");
        }
        return allGrade;
    }
}
